package main.java.design.command;

/**
 * <p>
 * 是抽象命令类的具体实现类，它拥有**接收者**对象，并通过调用接收者的功能来完成命令要执行的操作。持有对调用者的应用。
 * </p>
 *
 * @author : wangdejian
 * @version 1.0
 * @date : 2020/6/18 22:10
 */
public class DaNiaoCommand implements Command {

    // 持有一个对接收者的引用(这里就是烧烤师傅)
    private BarBecuerReceiver barBecuerReceiver;

    public DaNiaoCommand(BarBecuerReceiver barBecuerReceiver) {
        this.barBecuerReceiver = barBecuerReceiver;
    }

    @Override
    public void execute() {
        barBecuerReceiver.barbecue();
    }

    @Override
    public void undo() {
        barBecuerReceiver.cancelBarbecue();
    }
}
